package com.lzh.others.DataStucture;

/**
 * @author by lzh
 * @Classname maopao
 * @Description TODO
 * @Date 2022/1/13 0:09
 */
public class maopao {

    static int paixu(int[] nums, int k) {
        int temp;
        for (int i = 0; i < nums.length - 1; i++) {
            for (int j = i + 1; j < nums.length; j++) {
                if (nums[i] < nums[j]) {
                    temp = nums[i];
                    nums[i] = nums[j];
                    nums[j] = temp;
                }
            }
        }
        for (int i = 0; i < nums.length; i++) {
            System.out.println(nums[i] + " 第：" + (i + 1) + " 几个");
        }
        return nums[k - 1];
    }

    public static void main(String[] args) {
        int[] nums = {4, 2, 5, 1, 6, 6, 3, 8, 7, 9, 10};
        System.out.println("----------------------------------");
        int paixu = paixu(nums, 10);
        System.out.println(paixu);
    }
}
    